<html>
	<head>
		<meta charset="UTF-8" />
		<meta
			http-equiv="Content-Security-Policy"
			content="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline'; worker-src * data: 'unsafe-inline' 'unsafe-eval'; font-src * 'unsafe-inline' 'unsafe-eval';"
		/>
		<style>
			html {
				height: 100%;
				width: 100%;
				padding: 0;
				margin: 0;
			}
			body {
				height: 100%;
				width: 100%;
				padding: 0;
				margin: 0;
			}
			iframe {
				height: 100%;
				width: 100%;
				padding: 0;
				margin: 0;
				border: 0;
				display: block;
			}
		</style>
	</head>
	<body>
		<script>
			function sendMessage(data) {
				window.frames[0].postMessage(JSON.stringify(data), "*");
			}

			window.addEventListener("message", (event) => {
				if (event.source === window.frames[0]) {
					//console.log("frame -> vscode", event.data);
					//api.postMessage(event.data);
					var e = JSON.parse(event.data);
					if (e.event === "init") {
						sendMessage({ action: "load", xml: "", autosave: 1 });
					}
					if (e.event === "configure") {
						sendMessage({
							action: "configure",
							config: {
								compressXml: false,
								forceSimpleViewer: true,
							},
						});
					}
				}
			});
		</script>

		<iframe
			src="http://localhost:12345?embed=1&ui=dark&proto=json&noExitBtn=1&noSaveBtn=1&saveBtn=0&exitBtn=0&configure=1"
		></iframe>
	</body>
</html>
